<?php

/** 
 * @package ShareThisBar Plugin for Joomla! 1.5
 * @subpackage Form Element Menuitems
 * @version $Id: sharethisbar.php 3.5 2012-12-29 17:00:33Z Dusanka $
 * @author Dusanka Ilic
 * @copyright (C) 2012 - Dusanka Ilic, All rights reserved.
 * @authorEmail: gog27.mail@gmail.com
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html, see LICENSE.txt
**/

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

/**
 * Supports an HTML select list of menus.
 *
 * @since 3.5
 */

class JElementMenuItems extends JElement
{
	var	$_name = 'MenuItems';

	function fetchElement($name, $value, &$node, $control_name)
	{
                
		$ctrl	= $control_name .'['. $name .']';

		$attribs	= ' ';
		if ($v = $node->attributes('size')) {
			$attribs	.= 'size="'.$v.'"';
		}
		if ($v = $node->attributes('class')) {
			$attribs	.= 'class="'.$v.'"';
		} else {
			$attribs	.= 'class="inputbox"';
		}
		if ($m = $node->attributes('multiple'))
		{
			$attribs	.= 'multiple="multiple"';
			$ctrl		.= '[]';
		}
		
                $options	= JHTML::_('menu.linkoptions');
                //array_unshift( $options, JHTML::_('select.option',  '', '- '. JText::_( 'Select Menus' ) .' -' ) );
                
		return JHTML::_('select.genericlist',   $options, $ctrl, $attribs, 'value', 'text', $value, $control_name.$name );
                
	}
}
